Repository navigation
contextdb v2: a search index for vector columns - #22
Merged
Merged
Conversation
…and automatic search modes
Contributor
Author
|
GitHub Actions on The first run, on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a search index for vector columns to the workspace under
v2/. Nothing that builds fromcrates/changes; the rootCargo.tomlandCargo.lockare untouched. One commit ondevc79bdee.What is in it
AUTO_INDEX_ATvectors (100,000 unless declared) or declaresSEARCH_MODE INDEXED. Until then no centre and no sketch is written, so a small store stays the size it was. From there each partition's sealed vectors are grouped around centres, and every vector gets a one-bit-per-number sketch that a search reads before the vectors themselves.USE VECTOR EXACT,USE VECTOR INDEXED, and AUTO, which is what a statement gets when it names none.USE VECTOR EXACTis exact.LIMIT, AUTO finishes as an exact search andINDEXEDis refused by name.run_maintenance_cycleseals new vectors as before and now builds a partition's index in bounded steps, switching it in with one commit. A kill at any storage call leaves every vector found. Rows written meanwhile are searched through their own sketches until the next build takes them in. A step that does not fit the memory limit is recorded as stalled and the index in force keeps serving.quantization = 'SQ8'stores a table's vectors at one byte a number; it is an option a table chooses, never a default.SQ4is refused by name.SHOW VECTOR_INDEXES,SHOW VECTOR_PARTITIONS,Database::explainand the shell's.explainsay what a column holds and what a search would do..github/workflows/check.ymlstates 15,500 shipped lines and 260 tests (it stated 11,000 and 180).Measured at this commit
By
v2/numbers.sh: a release build on a 16-core AMD Ryzen 9 9955HX with 64 GB of memory and an NVMe drive, with nothing else running. One query at a time on one thread, a read session at 1 GiB, 95th percentile of 100 questions. Recall is the share of the exact answer's rows that the indexed answer returned; "all ten" counts the questions whose ten rows were all the same. The library picks the processor's bit-count instruction when it runs, and these times are with it.AUTO_INDEX_AT 1000cargo testAgainst the current engine, like for like
The same rows loaded clean into both engines, 500 to a commit, into the same table: text passages with one 768-number embedding each, in 8 partitions (a real workload that is not in the repository). The same 100 questions, a read session at 1 GiB, one query at a time, one core each, 95th percentile, same machine. The current engine and this change's exact search return the same ten rows for every question; this change's indexed search returns them at the recall above.
Verification
check.ymlas written, on the commit, plus the build on Rust 1.89 and a cross-compiled lint foraarch64-apple-darwin: all pass. 234 of 234 tests and the documentation tests; the storage library's 202; 15,443 shipped lines against the stated 15,500 and 253 tests against the stated 260.718698cda: the run is linked in a comment below when it finishes.explain; memory taken before it was asked for. The changes made after the second read were not read again by another model family.passes_mean,sketches_estimated_meanand tail lines ofv2/numbers.share what shows them.Known limits of this version
run_maintenance_cycle. Before a build a search returns the exact answer, slower.LIMITabove ten are not what it measured.EXPLAIN SELECTis not accepted as SQL;.explainandDatabase::explainare the doors. AVECTOR(n)column's clauses must be written in one order.SQ8) vector kept inside its row is expanded when the row is read, before the read's memory is asked for.